package com.cr.service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import com.cr.dao.CommentDao;
import com.cr.model.Comment;

public class CommentService {
	private CommentDao dao=new CommentDao();
	
	/**
	 * @param id
	 * @return
	 */
	public Comment getComment(long id)
	{
		return dao.getComment(id);
	}
	/**

	 * @param comment
	 * @return
	 */
	public boolean addComment(Comment comment)
	{
		if(comment==null)
			return false;
		Date now=new Date();

		SimpleDateFormat sdf2=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		String time=sdf2.format(now);
		comment.setTime(time);
		return dao.addComment(comment);
	}
	
	/**

	 * @return
	 */
	public List<Comment> getComments(long clothId)
	{
		return dao.getComments(clothId);
	}

}
